package demo2;

public class Cat {
    public String name;
    public int age;

    public Cat(String name, int age){
        this.name = name;
        this.age = age;
        // System.out.println("带两个参数的构造方法被执行");
    }

    public Cat(int age){
        this.age = age;
    }

    public Cat(){
        // this("大咪",6);
        // System.out.println("不带参数的构造方法被执行");
    }

    public void setName(String name, int age){
        this.name = name;
        this.age = age;
    }

    public void show(){
        System.out.println("姓名:" + this.name + ", 年龄:" + this.age);
    }

    @Override
    public String toString() {
        return "[姓名:" + "\'" +this.name + "\'" + ", 年龄:" + "\'" + this.age + "\'" + "]";
    }

}
